// 设备Api
import request from '@/utils/request'
import { AxiosPromise } from 'axios'
import { StationBo } from '@/api/business/station/types'

enum Api {
  list = '/station/list',
  delete = '/station/delete',
  batchDelete = '/station/batchDelete',
  add = '/station/add',
  edit = '/station/edit',
  detail = '/station/detail',
  optionSelect = '/station/optionSelect',
  optionNoAgentSelect = '/station/optionNoAgentSelect',
  changeStatus = '/station/changeStatus',
  pmscSetting = 'pmscSetting',
}

// 获取列表
export const getStationList = (data: any): AxiosPromise<any> => {
  return request({
    url: Api.list,
    method: 'post',
    data,
  })
}

// 删除
export const stationDelete = (data: string) => {
  return request({
    url: Api.delete,
    method: 'post',
    data,
  })
}
// 批量删除
export const stationBatchDelete = (data: (string | number)[]) => {
  return request({
    url: Api.batchDelete,
    method: 'post',
    data,
  })
}

// 编辑、保存
export const stationSave = (data: StationBo) => {
  return request({
    url: data.id ? Api.edit : Api.add,
    method: 'post',
    data,
  })
}

// 获取选择框列表
export const optionSelect = (data: any) => {
  return request({
    url: Api.optionSelect,
    method: 'post',
    data: data,
  })
}

export const optionNoAgentSelect = (data: any) => {
  return request({
    url: Api.optionNoAgentSelect,
    method: 'post',
    data: data,
  })
}

// 状态修改
export function changeStatus(id: string | number, status: number) {
  const data = {
    id,
    status,
  }
  return request({
    url: Api.changeStatus,
    method: 'post',
    data,
  })
}

// pmsc设置
export function pmscSetting(data: any) {
  return request({
    url: Api.pmscSetting,
    method: 'post',
    data,
  })
}
